<!--包含头部文件-->
{include file="public/header" /}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>店铺管理 <span class="c-gray en">&gt;</span> 库存管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div>
        <form action="?" method="get">
            <div style="display: inline-block">
                商品分类：
                <span class="select-box inline">
		<select name="goods_cate" class="select goods_cate">
            <option value="0" {if condition="$gets['goods_cate'] == 0" } selected{/if}>综合</option>
            {volist name="item_cates" id="vo"}
			<option value="{$vo.id}" {if condition="$vo['id'] == $gets['goods_cate']" }
                    selected{/if}>{$vo.name}</option>
            {/volist}
		</select>
		</span>
            </div>
            <div  style="display: inline-block">
                券后价格：
                <input type="text" name="min_price" id="min_price" value="{$gets.min_price|default=''}"
                       class="input-text" placeholder="最低价" style="width:100px;">
                -
                <input type="text" name="max_price" id="max_price" value="{$gets.max_price|default=''}"
                       class="input-text" placeholder="最高价" style="width:100px;">
            </div>
            <div  style="display: inline-block">
                排序：
                <span class="select-box inline">
		<select name="sort" class="select sort">
            <option value="0" {if condition="$gets['sort'] == 0" } selected{/if}>最新</option>
            <option value="1" {if condition="$gets['sort'] == 1" } selected{/if}>券后价（低到高）</option>
            <option value="2" {if condition="$gets['sort'] == 2" } selected{/if}>券后价（高到低）</option>
            <option value="3" {if condition="$gets['sort'] == 3" } selected{/if}>券面额</option>
            <option value="4" {if condition="$gets['sort'] == 4" } selected{/if}>销量</option>
            <option value="5" {if condition="$gets['sort'] == 5" } selected{/if}>拥金比例</option>
		</select>
		</span>
            </div>
            <div  style="display: inline-block">
                销量：
                <input type="text" name="sales_volume" id="sales_volume" value="{$gets.sales_volume|default=''}"
                       placeholder=" 销量" style="width:100px" class="input-text">
            </div>
            <div  style="display: inline-block">
                关键词：
                <input type="text" name="key_word" id="key_word" value="{$gets.key_word|default=''}" class="input-text" placeholder="关键词" style="width:200px;">
            </div>
            <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 筛选</button>
        </form>
    </div>

    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="13">商品列表</th>
        </tr>
        <tr class="text-c">
            <!--<th width="25"><input type="checkbox" name="" value=""></th>-->
            <th width="5%">图片</th>
            <th width="20%">商品名称</th>
            <th>类别</th>
            <th>店铺类型</th>
            <th>优惠券金额</th>
            <th>在售价</th>
            <th>券后价</th>
            <th>佣金比例</th>
            <th>活动类型</th>
            <th>月销量</th>
            <th>推荐</th>
            <th>优惠券结束时间</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            <!--<td><input type="checkbox" value="1" name=""></td>-->
            <td>
                {if condition="$vo['shoptype'] == 'B' "}
                <a href="https://detail.tmall.com/item.htm?id={$vo['itemid']}" target="_blank"><img src="{$vo.itempic}" width="100" height="100"></a>
                {else /}
                <a href="https://item.taobao.com/item.htm?id={$vo['itemid']}" target="_blank"><img src="{$vo.itempic}" width="100" height="100"></a>
                {/if}
            </td>
            <td>
                {if condition="$vo['shoptype'] == 'B' "}
                    <a href="https://detail.tmall.com/item.htm?id={$vo['itemid']}" target="_blank">{$vo.itemtitle}</a>
                {else /}
                <a href="https://item.taobao.com/item.htm?id={$vo['itemid']}" target="_blank">{$vo.itemtitle}</a>
                {/if}
            </td>
            <td>{$vo.cate_name}</td>
            <td>
                {if condition="$vo['shoptype'] == 'B' "} 天猫
                {else /} 淘宝
                {/if}</td>
            <td>{$vo.couponmoney}</td>
            <td>{$vo.itemprice}</td>
            <td>{$vo.itemendprice}</td>
            <td>{$vo.tkrates}%</td>
            <td>{$vo.activity_type}</td>
            <td>{$vo.itemsale}</td>
            <td>
                <select class="tuijian" name="tuijian" data-id="{$vo.itemid}">
                    <option value="0" {if condition="$vo['tuijian'] == 0" } selected{/if}>暂无推荐</option>
                    <option value="1" {if condition="$vo['tuijian'] == 1" } selected{/if}>甄值推荐</option>
                    <option value="2" {if condition="$vo['tuijian'] == 2" } selected{/if}>人气推荐</option>
                </select>
            </td>
            <td>{$vo.couponendtime|date="Y-m-d H:i:s", ###}</td>
        {/volist}
        </tbody>
    </table>
    <div class="row">
        <div class="col-sm-2" id="pageBox">
            {$page}
        </div>
    </div>
</div>
<!--包含footer文件-->
{include file="public/footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    /*
     参数解释：
     title	标题
     url		请求的url
     id		需要操作的数据id
     w		弹出层宽度（缺省调默认值）
     h		弹出层高度（缺省调默认值）
     */
    /*管理员-增加*/
    function admin_add(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*管理员-删除*/
    function goods_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '{:url("stock/goods_del")}',
                data:{"goods_id":id},
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    /*管理员-编辑*/
    function goods_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }

    $(function () {
        $(".tuijian").bind("change",function(){
            var tuijian = $(this).val();
            var id = this.dataset.id;
            $.ajax({
                type: 'POST',
                url: '{:url("operate/set_tuijian")}',
                data:{"id":id,"tuijian":tuijian},
                dataType: 'json',
                success: function(data){
                    if (data.code=200){
                        layer.msg('设置成功!',{icon:1,time:1000});
                    }else {
                        layer.alert('设置失败'+data.msg+'',{
                            skin: 'layui-layer-molv' //样式类名 自定义样式
                            ,closeBtn: 0  // 是否显示关闭按钮
                            ,anim: 1 //动画类型
                            ,btn: '确认'//按钮
                            ,icon: 6  // icon
                        })
                    }

                },
                error:function(data) {
                    layer.alert('请求失败',{
                        skin: 'layui-layer-molv' //样式类名 自定义样式
                        ,closeBtn: 0  // 是否显示关闭按钮
                        ,anim: 1 //动画类型
                        ,btn: '确认'//按钮
                        ,icon: 6  // icon
                    })
                },
            });
        });
    })


</script>
</body>
</html>